package com.smh.hmdianping.util;

import lombok.Data;

/**
 * @author shiminghui
 * @date 2025/3/27 15:37
 * @description: TODO
 */
public class UserLocalThread {

    private static final ThreadLocal<User> userThreadLocal = new ThreadLocal<User>();

    public static User getUser() {
        return userThreadLocal.get();
    }

    public static void setUser(User user) {
        userThreadLocal.set(user);
    }

    public static void remove() {
        userThreadLocal.remove();
    }

    @Data
    public static class User {
        private String name;
        private Integer age;
        private String sex;
    }

}
